<?php
/**
 * 周舟 hzboye010@163.com
 * addby sublime snippets
 * 帖子回复 测试类
 */
namespace app\test\controller;

use app\utils\BoyeService;
use app\test\controller\Ava;
class ForumPost extends Ava{

  //回帖评论
  public function postBBL(){
		if(IS_AJAX){
		  $data = [
				'tid'       =>I('post.tid',''),
				'page_no'   =>I('post.page_no',''),
				'page_size' =>I('post.page_size',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_postBBL',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_postBBL');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['tid',6731,LL('need-mark thread ID')],
		    ['page_no',1,L('page')],
		    ['page_size',5,L('page-size')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  //回帖评论
  public function replyPost(){
		if(IS_AJAX){
		  $data = [
				'fid'       =>I('post.fid',''),
				'tid'       =>I('post.tid',''),
				'pid'       =>I('post.pid',''),
				// 'author'   => I('post.author',''),
				'author_id' =>I('post.author_id',''),
				'to_uid' 		=>I('post.to_uid',''),
				'comment'   =>I('post.comment',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_replyPost',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_replyPost');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['fid',8,LL('need-mark block ID')],
		    ['tid',785,LL('need-mark thread ID')],
		    ['pid',1315,LL('post ID')],
		    // ['author','初来乍到',LL('need-mark user nickname')],
		    ['author_id',143,LL('need-mark user ID')],
		    ['comment','comment--',LL('need-mark comment content')],
		    ['to_uid',153,L('comment-arrive-user')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  //删除
  public function deleteComment(){
		if(IS_AJAX){

		  $data = [
				'uid'       =>I('post.uid',''),
				'cid'       =>I('post.cid',''),
				'tid'       =>I('post.tid',''),
				'pid'       =>I('post.pid',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_deleteComment',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_deleteComment');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['uid',18,LL('need-mark user ID')],
		    ['tid',1,LL('need-mark thread ID')],
		    ['pid',60,LL('need-mark post ID')],
		    ['cid',2,LL('need-mark comment ID')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  //删除
  public function delete(){
		if(IS_AJAX){

		  $data = [
				'uid'         =>I('post.uid',''),
				'fid'         =>I('post.fid',''),
				'tid'         =>I('post.tid',''),
				'pid'         =>I('post.pid',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_delete',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_delete');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['uid',50,LL('need-mark user ID')],
		    ['fid',1,LL('need-mark forum ID')],
		    ['tid',6136,LL('need-mark thread ID')],
		    ['pid',608,LL('need-mark post ID')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  //回帖
  public function reply(){
		if(IS_AJAX){

		  $data = [
				'fid'         =>I('post.fid',''),
				'tid'         =>I('post.tid',''),
				// 'author'      =>I('post.author',''),
				'author_id'   =>I('post.author_id',''),
				// 'subject'     =>I('post.subject',''),
				'message'     =>I('post.message',''),
				'attachments' =>I('post.attachments',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_reply',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_reply');
		  $this->assign('field',[
		    ['api_ver',101,LL('need-mark api version')],
		    ['fid',8,LL('need-mark forum ID')],
		    ['tid',785,LL('need-mark thread ID')],
		    // ['author','初来乍到',LL('need-mark nickname')],
		    ['author_id',143,LL('need-mark user ID')],
		    // ['subject','thread title',LL('need-mark thread title')],
		    ['message','回帖间隔测试',LL('need-mark')],
		    ['attachments','',L('thread-attach')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  
  //评论分页
  public function commentQuery(){
		if(IS_AJAX){

		  $data = [
				'tid'       =>I('post.tid',''),
				'pid'       =>I('post.pid',''),
				'page_no'   =>I('post.page_no',''),
				'page_size' =>I('post.page_size',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_commentQuery',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_commentQuery');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['tid',102,LL('need-mark thread ID')],
		    ['pid',192,LL('need-mark post ID')],
		    ['page_no',1,L('page')],
		    ['page_size',10,LL('page size')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  
  //详情
  public function detail(){
		if(IS_AJAX){

		  $data = [
				'tid'       =>I('post.tid',''),
				'fid'       =>I('post.fid',''),
				'pid'       =>I('post.pid',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_detail',
		  ];
		  $service = new BoyeService();
		  $result  = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_detail');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['fid',1,LL('need-mark forum ID')],
		    ['tid',6726,LL('need-mark thread ID')],
		    ['pid',613,LL('need-mark post ID')],
		  ]);
		  echo $this->display('ava/test');
		}
  }

  //分页查询
  public function query(){
		if(IS_AJAX){

		  $data = [
				'fid'        =>I('post.fid',''),
				'tid'        =>I('post.tid',''),
				// 'typeid'    =>I('post.typeid',''),
				'max_comment'=>I('post.max_comment',''),
				'all_reply'  =>I('post.all_reply',''),
				'page_no'    =>I('post.page_no',''),
				'page_size'  =>I('post.page_size',''),
				'order'      =>I('post.order',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_ForumPost_query',
		  ];
		  $service = new BoyeService();
		  $result = $service->callRemote("",$data,true);
		  echo $this->parseResult($result);

		}else{
		  $this->assign('type','BY_ForumPost_query');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['fid',1,LL('forum ID')],
		    ['tid',6118,LL('need-mark thread-tid')],
		    // ['typeid',0,L('thread cate ID')],
		    ['max_comment',2,LL('max comment')],
		    ['all_reply',0,L('all-reply')],
		    ['page_no',1,L('page')],
		    ['page_size',10,LL('page size')],
		    ['order',0,L('order')],
		  ]);
		  echo $this->display('ava/test');
		}

  }
}